require_once "functions.php"; require_once "datatypes.php"; InitUser(); include_once "useronline/addonline.php"; include "dailyhits.php"; CheckMySQL(); $id = $HTTP_GET_VARS["id"]; $type = $HTTP_GET_VARS["type"]; $query = "SELECT Title,Views FROM images WHERE Id = '$id'"; $result = MySQL_query($query); While( $rows = MySQL_fetch_array($result) ) { $title = $rows['Title']; $viewsold = $rows['Views']; } $views = "$viewsold"+1; $sql = "UPDATE images SET Views = '$views' WHERE Id = '$id'"; $result = MySQL_query($sql); $sqlprev = "SELECT Id FROM images WHERE Id < '$id' ORDER BY Id DESC LIMIT 1"; $sqlnext = "SELECT Id FROM images WHERE Id > '$id' LIMIT 1"; $result = MySQL_query($sqlprev); $rows = MySQL_fetch_array($result); $prev = $rows['Id']; $result = MySQL_query($sqlnext); $rows = MySQL_fetch_array($result); $next = $rows['Id']; MySQL_Close(); if ($title=="") { If ($next) { header("Location: http://www.phrozenflame.com/image/$next"); } else { If ($prev) { header("Location: http://www.phrozenflame.com/image/$prev"); } else { header("Location: http://www.phrozenflame.com/pImages.html"); } } } else { ?>